package com.blues.pattern.factory.simple;

import com.blues.pattern.factory.HuoTui;

/**
 * design_pattern
 * 类描述：
 *
 * @author spring·blueices
 * @create 2018-03-19 下午11:27
 **/
public class HuoTuiCommonFactory {

    public static <T> T getClass(Class<? extends T> clazz) {
        T obj = null;

        try {
            obj = (T) Class.forName(clazz.getName()).newInstance();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        return obj;
    }

    public static HuoTui getHuoTui(Class<?extends HuoTui> clazz) {
        HuoTui obj = null;

        try {
            obj =(HuoTui) Class.forName(clazz.getName()).newInstance();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        return obj;
    }
}
